package cn.lyjuan.android.mylibrary.frame.load.impl;

import android.app.Activity;
import android.app.Fragment;

import java.util.ArrayList;
import java.util.List;

import cn.lyjuan.android.mylibrary.R;
import cn.lyjuan.android.mylibrary.frame.load.fragment.AbstractLoadFailedFragment;
import cn.lyjuan.android.mylibrary.frame.load.fragment.LoadFailedFragmentImpl;
import cn.lyjuan.android.mylibrary.util.BluetoothUtils;

/**
 * 提供判断没有网络的情况下加载网络视图
 * Created by chad on 12/11/2017.
 */
public class BluetoothLoadImpl extends AbstractLoad
{
    public BluetoothLoadImpl(Activity context)
    {
        super(context);
    }

    @Override
    public List<String> enforcePermission()
    {
        List<String> list = new ArrayList<>(1);
        list.add("android.permission.BLUETOOTH");
        list.add("android.permission.BLUETOOTH_ADMIN");
        list.add("android.hardware.location.gps");
        list.add("android.permission.ACCESS_FINE_LOCATION");
        list.add("android.permission.ACCESS_COARSE_LOCATION");
        return list;
    }

    @Override
    public List<String> recomPermission()
    {
        return null;
    }

    public BluetoothLoadImpl(Activity context, Fragment normal, int containerId)
    {
        super(context, normal, containerId);
    }

    @Override
    public AbstractLoadFailedFragment failedFragment()
    {
        return LoadFailedFragmentImpl.newInstance(R.string.fragment_tip_bluetooth, R.drawable.other_load_tip_bluetooth)
                .setOnReloadListener(this);
    }

    @Override
    public boolean shouldNormal()
    {
        return BluetoothUtils.hasPermission();
    }
}
